#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/4/23 14:25
# @Author  : 王凯
# @File    : crawler.py
# @Project : scrapy_spider
import requests

headers = {
    "Host": "api.pinduoduo.com",
    "etag": "yDV45CJF",
    "accesstoken": "5QQ2JH3MY3JODBZ6YB3IES2YPUYFWUC44WA4DMSKSJCEA5LMV5OQ121c274",
    "referer": "Android",
    "content-type": "application/json;charset=UTF-8",
    "p-appname": "pinduoduo",
    "p-proc-time": "2432914",
    "x-pdd-info": "bold_free%3Dfalse%26bold_product%3D%26front%3D0%26tz%3DAsia%2FShanghai",
    "x-pdd-queries": "width=1080&height=1920&net=1&brand=Xiaomi&model=MI+9&osv=9&appv=6.73.0&pl=2",
    "x-yak-llt": "1713852884283",
    "p-proc": "main",
    "p-mediainfo": "player=2.0.4&rtc=1.0.0",
    "x-b3-ptracer": "hctrue96afdafbae4a4839a3e6905ae3",
    "user-agent": "android Mozilla/5.0 (Linux; Android 9; MI 9 Build/PQ3A.190605.04081832; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36  phh_android_version/6.73.0 phh_android_build/a29b63f6c97be3675aff8f5f661fcddf1f6b713b phh_android_channel/vivo pversion/0",
    "pdd-config": "V4:001.067300",
    "multi-set": "1,0,25",
    "anti-token": "2agH0+94yJ7L3kwScd3onw+x8KW/IBsZvVgY5VGT902iIFxRAavrEAmXjakvhxClgiPYTlgzgyCrv6Gs8T8BnzCqQ==",
    "vip": "81.69.104.49",
}
cookies = {"acid": "4f0dc15f527e8b5877cc46b4b4625c8d", "api_uid": "CiUgJ2YnLs4zeABQgd6TAg=="}
url = "https://api.pinduoduo.com/api/turing/mall/query_mall_category_list"
params = {"mall_id": "808036656", "msn": "xnztkdgwiwu7h7t2wykcjrzpbq_axbuy", "type": "1", "pdduid": "1576526274"}
response = requests.get(url, headers=headers, cookies=cookies, params=params)

print(response.text)
print(response)

import requests

headers = {
    "Host": "api.pinduoduo.com",
    "accept": "application/json, text/plain, */*",
    "etag": "EQLNG0vV",
    "accesstoken": "TTN6FGZDPX7O6HRXDSADHYUJYJ2LITV5H6PI6XOLI3QMNQUU5NEQ120725f",
    "referer": "https://m.pinduoduo.net/mall_page.html?mall_id=514487514&msn=tcgx7zed2lgnmdfb4jwrw4ogwu_axbuy&has_decoration=1&mall_type=0&page_from=23&_x_query=%E5%8D%8E%E4%B8%BA",
    "p-mode": "1",
    "content-type": "application/json;charset=UTF-8",
    "p-appname": "pinduoduo",
    "p-proc-time": "67501",
    "x-pdd-info": "bold_free%3Dfalse%26bold_product%3D%26front%3D1%26tz%3DAsia%2FShanghai",
    "x-pdd-queries": "width=1080&height=2030&net=1&brand=xiaomi&model=MI+6X&osv=8.1.0&appv=7.6.0&pl=2",
    "p-proc": "main",
    "x-b3-ptracer": "hctrue855f3327cbcd4cbf8f749d8b8e",
    "user-agent": "android Mozilla/5.0 (Linux; Android 8.1.0; MI 6X Build/OPM1.171019.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36  phh_android_version/7.6.0 phh_android_build/14b765de63786a34e50acf2bf3db1e02d80de9c6 phh_android_channel/lite_baidu_sem app_type/lite pversion/0",
    "pdd-config": "V4:001.070600",
    "multi-set": "1,0,25",
    "anti-token": "2af06o0hXwG2W/Hj85hqNZW9gOofMqoq0TicoQ4xuKK+qFUDJPLPCNA/ZVJax5ZMDaAQSIrV1pW3ck7sd/0lVA7hi2uwtzkrQ/aPuPYMe5weFM5NExVhzbpWWKRfaQ1d8gHp9S8ToGPEYkSaHRRnypnO6d80nDgfYq8lItk2/YPQHYpCODjJoTkEqxNLnDxahtBAcrmr7tWwtKaWwgFX46kDx9mqLa0EHGH40PGJGVxO8tvy/OtmQQx6rBWQJ3YRDQGRmlXqy+9DVXWHaJ8hgig4r9KR2CeQ2FlF8P8VpW6wPGLgJLGASI2rrPJuzyIFn9y9FwXwckaTefZhOKe8X1w4Kyq1AhQa38sefBFCJeCDwa8br0RebqUkSLfUiatAaq37IDZr4udTzof9SqfPAKzrHqw9KFjzY76DbQmZCgekR3KVF+hXFkrTcsSVyuHWHtX+izJEupNo6Z4W8ArMWaqsA==",
    "vip": "81.69.208.27",
}
cookies = {"api_uid": "Ck2+aGYrUy0CggBtiu/GAg=="}
"/assets/js/react_mall_page_57a4f50e4fcf6594467a.js"
url = "https://api.pinduoduo.com/api/turing/mall/query_cat_goods"
params = {
    "pdduid": "7440452829298",
    "anticontent": "0arWfqnUYjoyj9vZhXPf2Ueew2ABtPvVE8ooy8fKg8GMLeZ_EzmZN7LiHj8GoE6U7XJdIu5s5DLO17zTb4txPlK2VOC9aTl9cqIpPxP_yCoyd-LYoOtwIT_TG3Lf6apTSiHnMLC5WToYumfJkCm3IgaGVKRCp2f5uZkpOIOGUB-ZkdVQTebUIVbG1GbyCSPpgA0IMKDA7N-yr_d2ss-6s95xjBDFn2EENYqMk1sOiG0-zlQ78XNiwVnOZaEGgOrI6EQtWDuAM0HUQbjoHIoFOWlMIWEj8bZYd_y4qKLVZmp06VCBvZscdfj7dg80RRbTyuJndxSNlxt7oy7ugHqU2gaq93e6BnfgqsKmr4yH2m2yOEQsfgPsNBV2JwEGfuOfcfaub0gBV8_fvtgsOsOCagOu_rdEWHJ7ps155gIQMUJj3Y2xUywOYytm2HOkwcVZRmdQKMFjIRLbYxGIBdv0yp-n5-DzMJskYgs7YUgQCOG9SaNi5rXWoOE2gTvDNDlBllu6zfiwiuPjkvLn-kvIFguZGPCtO_6sXHgZP_DVwrbeAo-4v3ZZsQWUnqfLrhkjiRMih0kg8aEI8amgMRAKP5llhlGciuXze7If1hqfzoMhRoAo7MlhYotAikjgyEGGco5m4SIAn3CR59uJzZRNl6FeewfHrH0uGVCFl_3jk8hfPrnybFARtQnyVL6dcziQI-7zonWy9OGkjU8SnSgASKQKDWnGNtTkoXTAeHAfN92vkal",
    "anti_content": "0arWfqnUYjoyj9vZhXPf2Ueew2ABtPvVE8ooy8fKg8GMLeZ_EzmZN7LiHj8GoE6U7XJdIu5s5DLO17zTb4txPlK2VOC9aTl9cqIpPxP_yCoyd-LYoOtwIT_TG3Lf6apTSiHnMLC5WToYumfJkCm3IgaGVKRCp2f5uZkpOIOGUB-ZkdVQTebUIVbG1GbyCSPpgA0IMKDA7N-yr_d2ss-6s95xjBDFn2EENYqMk1sOiG0-zlQ78XNiwVnOZaEGgOrI6EQtWDuAM0HUQbjoHIoFOWlMIWEj8bZYd_y4qKLVZmp06VCBvZscdfj7dg80RRbTyuJndxSNlxt7oy7ugHqU2gaq93e6BnfgqsKmr4yH2m2yOEQsfgPsNBV2JwEGfuOfcfaub0gBV8_fvtgsOsOCagOu_rdEWHJ7ps155gIQMUJj3Y2xUywOYytm2HOkwcVZRmdQKMFjIRLbYxGIBdv0yp-n5-DzMJskYgs7YUgQCOG9SaNi5rXWoOE2gTvDNDlBllu6zfiwiuPjkvLn-kvIFguZGPCtO_6sXHgZP_DVwrbeAo-4v3ZZsQWUnqfLrhkjiRMih0kg8aEI8amgMRAKP5llhlGciuXze7If1hqfzoMhRoAo7MlhYotAikjgyEGGco5m4SIAn3CR59uJzZRNl6FeewfHrH0uGVCFl_3jk8hfPrnybFARtQnyVL6dcziQI-7zonWy9OGkjU8SnSgASKQKDWnGNtTkoXTAeHAfN92vkal",
    "category_id": "0",
    "type": "0",
    "mall_id": "514487514",
    "page_size": "20",
    "sort_type": "_sales",
    "refer_page_param": "undefined",
    "refer_page_sn": "0",
    "msn": "tcgx7zed2lgnmdfb4jwrw4ogwu_axbuy",
    "x_query": "华为",
    "flip": "",
    "list_id": "2j29hr5pji73v8wx",
    "page_from": "39",
    "query": "",
    "goods_id": "0",
    "new_store_goods": "",
    "show_priority_type": "1",
    "show_condition": "null",
    "data_type_list": "1",
    "pair_goods_id_list": "",
    "filter_condition": "",
    "query_shipping_option": "1",
    "card_num_after_last_card": '[{"card_type":2,"card_num":7}]',
    "card_num_total": "",
    "page_no": "1",
}
response = requests.get(url, headers=headers, cookies=cookies, params=params)

print(response.text)
print(response)

import requests

headers = {
    "Host": "api.pinduoduo.com",
    "accept": "application/json, text/plain, */*",
    "etag": "EQLNG0vV",
    "accesstoken": "TTN6FGZDPX7O6HRXDSADHYUJYJ2LITV5H6PI6XOLI3QMNQUU5NEQ120725f",
    "referer": "https://m.pinduoduo.net/mall_page.html?mall_id=982418036&msn=dgzc3dqthhxr6ngctc3eerqwxm_axbuy&mall_type=0&page_from=23&_x_query=%E5%BE%97%E5%8A%9B%E7%B2%A4%E4%B8%B0%E4%B8%93%E5%8D%96%E5%BA%97",
    "p-mode": "1",
    "content-type": "application/json;charset=UTF-8",
    "verifyauthtoken": "3FQcPKzGpYXJmUY29PQ0sw3ac8b0b25122f998e",
    "p-appname": "pinduoduo",
    "p-proc-time": "1827745",
    "x-pdd-info": "bold_free%3Dfalse%26bold_product%3D%26front%3D1%26tz%3DAsia%2FShanghai",
    "x-pdd-queries": "width=1080&height=2030&net=1&brand=xiaomi&model=MI+6X&osv=8.1.0&appv=7.6.0&pl=2",
    "p-proc": "main",
    "x-b3-ptracer": "hctrue3fd73f9686724f5c8ab3d03969",
    "user-agent": "android Mozilla/5.0 (Linux; Android 8.1.0; MI 6X Build/OPM1.171019.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36  phh_android_version/7.6.0 phh_android_build/14b765de63786a34e50acf2bf3db1e02d80de9c6 phh_android_channel/lite_baidu_sem app_type/lite pversion/0",
    "pdd-config": "V4:001.070600",
    "multi-set": "1,0,25",
    "anti-token": "2agHOXNBsXf21AMFpwveTPAws9faoaIPsfQ8nhcEWaK8LEW4jiqhjVLZVU0mollmad6fX17Vplhcq0yD0jxL+66Fw==",
    "vip": "81.69.104.65",
}
cookies = {"api_uid": "Ck2+aGYrUy0CggBtiu/GAg=="}
url = "https://api.pinduoduo.com/api/turing/mall/query_mall_category_list"
params = {"pdduid": "7440452829298", "mall_id": "982418036", "msn": "dgzc3dqthhxr6ngctc3eerqwxm_axbuy"}
response = requests.get(url, headers=headers, cookies=cookies, params=params)

print(response.text)
print(response)

"""
1714113984212, str: EQLNG0vV

"""

import requests

headers = {
    "Host": "m.pinduoduo.net",
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_8_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Model/iPhone8,1 phh_ios_version/7.7.0 phh_ios_build/202404211256 pversion/0",
    "x-pdd-queries": "width=750.000000&height=1334.000000&brand=apple&model=iPhone 6s&osv=15.8.2&appv=7.7.0&pl=iOS&net=1",
    "p-uno-context": '{"ls":0,"webp":0}',
}
cookies = {
    "webp": "1",
    "pdd_vds": "gaALjOWEJGSOknMNKaSIkbqykGKoJyqIzIJmVyqIXIjOSQFbHISLSGHoVmKt",
    "group_rec_list": "group_rec_list_t3jrva",
    "ETag": "Q6bgvlp5",
    "PDDAccessToken": "LX7TLTRC2ZW76MUAOWNDHNZKD2YHYJAMPLUTFULKOIHSDVFGYWOA1205c0c",
    "install_token": "622F9637-7271-4B65-BD54-FBF6BD2FD362",
    "pdd_user_id": "8664931343452",
    "pdd_user_uin": "YWUE7W3HDBQDMFVN7JEQRRXSMA_GEXDA",
    "_nano_fp": "Xpman0P8XpPbXqTxno_jIK~Xu9cgO54dLNjPGw2k",
    "api_uid": "Ck1lFWYttB6s/QBb37rDAg==",
}
url = "https://m.pinduoduo.net/mall_certificates.html"
params = {
    "refer_page_id": "10039_1714293827244_2523247540",
    "refer_page_name": "mall_subject",
    "mall_id": "255735058",
    "refer_page_sn": "10039",
    "_x_query": "发现美假发",
}
response = requests.get(url, headers=headers, cookies=cookies, params=params)

print(response.text)
print(response)
"https://mobile.yangkeduo.com/mall_subject.html?_t_rpn=mall_personal_info&mall_id=106261223&refer_page_name=mall_page&refer_page_id=10039_1714469068408_uin64n6sna&refer_page_sn=10039"
